/**
 * 
 */
package com.demo2do.sms.entity.sms;

import java.io.Serializable;

import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * @author downpour
 *
 */
public class SmsRequest implements Serializable {

    private static final long serialVersionUID = 175785630649137241L;

    /** 13888881111 */
    private String mobiles;
    
    /** your verify code is 0320 */
    private String message;
    
    /** demo2do */
    private String client;

    /** md5hex('demo2do_1111') */
    private String signature;
    
    /**
     * The default constructor
     */
    public SmsRequest() {
        
    }
    
    /**
     * 
     * @return
     */
    public boolean isValid() {
        String hex = DigestUtils.md5Hex(this.client + "_" + this.mobiles.substring(this.mobiles.length() - 4));
        return StringUtils.equals(this.signature, hex);
    }
    
    /**
     * @return the mobiles
     */
    public String getMobiles() {
        return mobiles;
    }

    /**
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * @return the client
     */
    public String getClient() {
        return client;
    }

    /**
     * @return the signature
     */
    public String getSignature() {
        return signature;
    }
    
    /**
     * @param mobiles the mobiles to set
     */
    public void setMobiles(String mobiles) {
        this.mobiles = mobiles;
    }

    /**
     * @param message the message to set
     */
    public void setMessage(String message) {
        this.message = message;
    }

    /**
     * @param client the client to set
     */
    public void setClient(String client) {
        this.client = client;
    }

    /**
     * @param signature the signature to set
     */
    public void setSignature(String signature) {
        this.signature = signature;
    }
    
}
